-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Brenda Rios - Solar System - Octos #31
base: master
Are you sure you want to change the base?
Conversation
Solar SystemWhat We're Looking For
|
# Method for the user to create a new planet | ||
def new_planet(solar) | ||
|
||
# The loop will enable the user to continue adding new planets until wanted. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like that you've broken this and read_about_planet
out as separate methods. Good organization!
interface(system_) | ||
|
||
# Planets list will be updated | ||
again(system_) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's an interesting interaction here, where interface
calls again
, which in turn calls interface
. The repeated calls end up making a loop. This is an example of a programming technique called recursion, which you'll learn about in CS Fun in a few months.
Recursion is a powerful tool that can elegantly solve many problems. However, in this case I think a while
loop might be a better choice, if only because it makes it immediately obvious to the reader that this code might execute many times.
Solar System
Congratulations! You're submitting your assignment.
Comprehension Questions
initialize
method in your class?SolarSystem
used anArray
vs aHash
.